Crate cirru_parser
source ·Expand description
§Cirru Parser
This tiny parser parses indentation based syntax into nested a vector, then it could used as S-Expressions for evaluation or codegen.
defn fib (x)
if (<= x 2) 1
+
fib $ dec x
fib $ - x 2
parses to:
[ ["defn" "fib" [ "x" ]
[ "if" [ "<=" "x" "2" ] "1"
[ "+" [ "fib" ["dec" "x"] ] [ "fib" ["-" "x" "2"] ] ]
]
] ]
find more on http://text.cirru.org/ .
Structs§
- options for writer,
use_inline
for more compact format.
Enums§
- Cirru uses nested Vecters and Strings as data structure
- internal control item during lexing
Functions§
- common API for turning Cirru leaf with strings escaped
- format Cirru code, use options to control
use_inline
option - format to Cirru to WAT
- internal function for lexing
- parse function, parse String to Cirru.
- internal function for figuring out indentations after lexing
Type Aliases§
- a list to lex nodes